[TPM] Check the existence of the xenstore path before trying to read from it.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 18 Oct 2006 17:37:18 +0000 (18:37 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 18 Oct 2006 17:37:18 +0000 (18:37 +0100)
This prevents an error from being logged. Use the wrapped command for
reading from the xenstore instead of the native one.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/examples/vtpm-common.sh

index e5e8ddbbf5f859650090ec2af2f15e547ad60be8..bf50f323e36b7c6f05256bc21ca4ed0d28233b17 100644 (file)
@@ -226,7 +226,7 @@ function vtpmdb_remove_entry () {
 # Returns 'resume' or 'create'
 function vtpm_get_create_reason () {
        local resume
-       resume=$(xenstore-read $XENBUS_PATH/resume)
+       resume=$(xenstore_read $XENBUS_PATH/resume)
        if [ "$resume" == "True" ]; then
                echo "resume"
        else
@@ -287,6 +287,8 @@ function vtpm_create_instance () {
 #entry is kept in the VTPMDB file.
 function vtpm_remove_instance () {
        local instance reason domname
+       #Stop script execution quietly if path does not exist (anymore)
+       xenstore-exists "$XENBUS_PATH"/domain
        domname=$(xenstore_read "$XENBUS_PATH"/domain)
 
        if [ "$domname" != "" ]; then
@@ -383,7 +385,7 @@ function vtpm_domid_from_name () {
        local id name ids
        ids=$(xenstore-list /local/domain)
        for id in $ids; do
-               name=$(xenstore-read /local/domain/$id/name)
+               name=$(xenstore_read /local/domain/$id/name)
                if [ "$name" == "$1" ]; then
                        echo "$id"
                        return